package exception;

/**
 * finally块的演示
 */

public class FinallyDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        //try放有可能会发生错误的代码块
        try {
            String line = null;
            //System.out.println(line.length());
            System.out.println(line);
            return;//在return结束方法之前，会先finally再return
          //catch放try发生错误时，所执行的代码块
        } catch (Exception e) {
            System.out.println("出错并解决了");

        } finally {
            System.out.println("finally还可以再抢救一下！");
        }
        System.out.println("程序结束了");
    }
}
